{%TEMPLATE->struct/head%}
{%TEMPLATE->struct/menu%}
<h2>Superhashlists ([[sizeof([[lists]])]])</h2>
{%TEMPLATE->struct/messages%}
<div class="card">
  <div class="table-responsive">
    <table class="table table-bordered table-sm" id="superhashlists">
      <thead>
        <tr>
          <th>ID</th>
          <th>Name</th>
          <th>Hash type</th>
          <th>Cracked</th>
          <th>Hashlists</th>
          <th>Pre-cracked</th>
          <th>Action</th>
        </tr>
      </thead>
      <tbody>
        {{FOREACH list;[[lists]]}}
          <tr>
            <td>
              <a href="hashlists.php?id=[[list.getId()]]">[[list.getId()]]</a>
            </td>
            <td>
              <a href="hashlists.php?id=[[list.getId()]]">[[list.getHashlistName()]]</a>
              {{IF [[list.getIsSecret()]] == 1}}
                <span class="fas fa-lock" aria-hidden="true"></span>
              {{ENDIF}}
              [[Util::tickdone([[list.getCracked()]], [[list.getHashCount()]])]]
            </td>
            <td>
              [[hashtypes.getVal([[list.getHashtypeId()]])]]
            </td>
            <td data-sort="[[list.getCracked()]]">
              [[Util::showperc([[list.getCracked()]], [[list.getHashCount()]])]]%<br>
              (<a href="hashes.php?hashlist=[[list.getId()]]&filter=cracked">[[list.getCracked()]]</a>
              / <a href="hashes.php?hashlist=[[list.getId()]]">[[list.getHashCount()]]</a>)
            </td>
            <td>
              {{FOREACH subList;[[subLists.getVal([[list.getId()]])]]}}
                <a href="hashlists.php?id=[[subList.getId()]]">[[subList.getHashlistName()]]</a><br>
              {{ENDFOREACH}}
            </td>
            <td>
              {{IF [[accessControl.hasPermission([[$DAccessControl::MANAGE_HASHLIST_ACCESS]])]]}}
                <form class="float-right mx-1" action="hashlists.php" method="POST">
                  <input type="hidden" name="action" value="[[$DHashlistAction::EXPORT_HASHLIST]]">
                  <input type="hidden" name="hashlist" value="[[list.getId()]]">
                  <input type="hidden" name="csrf" value="[[csrf]]">
                  <button type="submit" class='btn {{IF [[toggledarkmode]] > 0}}btn-primary{{ELSE}}btn-light{{ENDIF}}' data-toggle="tooltip" data-placement="top" title="Export"><i class="fas fa-file-export" aria-hidden="true"></i></button>
                </form>
                <form class="float-right mx-1" action="hashlists.php" method="POST">
                  <input type="hidden" name="action" value="[[$DHashlistAction::ZAP_HASHLIST]]">
                  <input type="hidden" name="hashlist" value="[[list.getId()]]">
                  <input type="hidden" name="csrf" value="[[csrf]]">
                  <button type="submit" class='btn {{IF [[toggledarkmode]] > 0}}btn-primary{{ELSE}}btn-light{{ENDIF}}' data-toggle="tooltip" data-placement="top" title="Import"><i class="fas fa-file-import" aria-hidden="true"></i></button>
                </form>
              {{ENDIF}}
            </td>
            <td>
              {{IF [[accessControl.hasPermission([[$DAccessControl::MANAGE_HASHLIST_ACCESS]])]]}}
                <form class="float-right" action="hashlists.php" method="POST" onSubmit="if (!confirm('Really delete superhashlist [[list.getId()]]?\n(Included hashes will stay intact in their hashlists)')) return false;">
                  <input type="hidden" name="action" value="[[$DHashlistAction::DELETE_HASHLIST]]">
                  <input type="hidden" name="hashlist" value="[[list.getId()]]">
                  <input type="hidden" name="csrf" value="[[csrf]]">
                  <button type="submit" class='btn btn-danger' data-toggle="tooltip" data-placement="top" title="Delete"><i class="fas fa-trash" aria-hidden="true"></i></button>
                </form>
              {{ENDIF}}
            </td>
          </tr>
        {{ENDFOREACH}}
      </tbody>
    </table>
    <script type="text/javascript">
      $(document).ready(function () {
        $('#superhashlists').DataTable({
          pageLength: 50,
          "order": [ [0, 'asc'] ],
          "columnDefs": [
            { "orderable": false, "targets": [5, 6] },
            { "orderable": true, "targets": [0, 1, 2, 3, 4] }
          ]
        });
      });
    </script>
  </div>
</div>
{%TEMPLATE->struct/foot%}
